window.onload = function () {
    function fun() {
        console.log(30);
        let content = document.querySelector(".content");
        let data = JSON.parse(localStorage.getItem("dataList"));
        content.innerHTML = data.map((item) => {
            return `<div class="media">
                <div class="media-left media-middle">
                    <input type="checkbox" data_id="${
                        item.goods_id
                    }"  class="checked" ${
                    item.is_select == "1" ? "checked" : ""
                }/>
                    <a href="#">
                        <img
                            class="media-object"
                            src="${item.ba}"
                            alt="..."
                        />
                    </a>
                </div>
                <div class="media-body">
                    <h4 class="media-heading">${item.er}</h4>
                    <p class="price">
                        <span
                            class="glyphicon glyphicon glyphicon-jpy"
                            aria-hidden="true"
                        ></span>
                        <span>${item.san}</span>
                    </p>
                    <div class="btns">
                        <button data_id=" ${
                            item.goods_id
                        }" class="btn btn-danger btn-delete btn-sm">删除商品</button>
                        <div class="btn-group" data_id="${
                            item.goods_id
                        }" role="group">
                            <button
                                type="button"
                                class="btn reduce ${
                                    item.cart_number == 1 ? "disabled" : ""
                                } btn-sm btn-default" ${
                    item.cart_number == 1 ? "disabled" : ""
                }
                            >
                                -
                            </button>
                            <button
                                type="button"
                                class="btn btn-sm btn-default"
                            >
                                ${item.cart_number}
                            </button>
                            <button
                                type="button"
                                class="btn add btn-sm btn-default"
                            >
                                +
                            </button>
                        </div>
                    </div>
                </div>
            </div>`
        }).join("");




        //设置cookie
        let login = getCookie("login");

        if (!login) {
            localStorage.setItem("url", location.href);
            location.href = "../login/login.html";
        }
    }
    fun();
}